<?php


namespace app\admin\controller;


use app\AdminBaseController;
use think\facade\Request;
use think\facade\View;
use app\admin\model\Role as RoleModel;

class Role extends AdminBaseController
{
    function index(){
        //判断是否是ajax请求
        if (Request::isAjax()){
            //返回Admin列表数据
            $roles = RoleModel::order('id','asc')->paginate(Request::get('limit'));
            return $this->jsonApi('角色数据','0',$roles->items(),['count'=>$roles->total(),'limit'=>Request::get('limit')]);
        }
        //打开页面
        return View::fetch();
    }

}